package xiaopiya.robot.handler.rss;

import java.io.Serializable;

/**
 * @author Ray (ayufox@gmail.com)
 * 
 */
public class ChannelKey implements Serializable
{
	private String channel;

	private String childChannel;

	public ChannelKey(String channel, String childChannel)
	{
		this.channel = channel;
		this.childChannel = childChannel;
	}

	public String getChannel()
	{
		return channel;
	}

	public String getChildChannel()
	{
		return childChannel;
	}

	private int hashCode = 0;

	public int hashCode()
	{
		if (this.hashCode == 0)
		{
			this.hashCode = this.channel.hashCode() * 37
					+ this.childChannel.hashCode();
		}
		return this.hashCode;
	}

	public boolean equals(Object obj)
	{
		if (obj instanceof ChannelKey)
		{
			ChannelKey key = (ChannelKey) obj;

			return (this.channel.equals(key.channel) && this.childChannel
					.equals(key.childChannel));
		}

		return false;
	}

	public String toString()
	{
		return "ChannelKey[channel=" + this.channel + ",childchannel="
				+ this.childChannel + "]";
	}
}
